package practice.w918;

public class ThrowDemo {
    public static void main(String[] args) {
        Person p = new Person();
        try {
            p.setAge(1000);
        } catch(IllegalAgeException e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
        System.out.println("此人年龄:"+p.getAge());


//        Person p = new Person();
//        try {
//            p.setAge(1000);
//        } catch(IllegalAgeException e) {
//            e.printStackTrace();
//            System.out.println(e.getMessage());
//        }
//        System.out.println("此人年龄:"+p.getAge());
    }
}